package model

import "gin-worked/dao"

type UserInfo struct {
	Id         int    `json:"id"`
	UserId     int    `gorm:"column(user_id)" json:"user_id"`
	HeadImg    string `gorm:"column(head_img)" json:"head_img"`
	Tel        string `gorm:"column(tel)" json:"tel"`
	Sex        int    `gorm:"column(sex)" json:"sex"`
	Name       string `gorm:"column(name)" json:"name"`
	Nickname   string `gorm:"column(nickname)" json:"nickname"`
	IsBind     int    `gorm:"column(is_bind)" json:"is_bind"`
	Status     int    `gorm:"column(status)" json:"status"`
	Type       int    `gorm:"column(type)" json:"type"`
	Email      string `gorm:"column(email)" json:"email"`
	IsReal     int    `gorm:"column(is_real)" json:"is_real"`
	CreateTime int    `gorm:"column(create_time)" json:"create_time"`
	UpdateTime int    `gorm:"column(update_time)" json:"update_time"`
	DeleteTime int    `gorm:"column(delete_time)" json:"delete_time"`
}

func UserInfoDetails(data *UserInfo, field []string) (UserInfo, error) {
	var userInfo UserInfo
	err := dao.Db.Select(field).Where(data).First(&userInfo).Error
	return userInfo, err
}
